home *** CD-ROM | disk | FTP | other *** search
/ Aminet 22 / Aminet 22 (1997)(GTI - Schatztruhe)[!][Dec 1997].iso / Aminet / biz / dopus / ImageFX.lha / ImageFX.dopus5 next >
Text File  |  1997-09-06  |  3KB  |  102 lines

  1. /*
  2.  $VER: ImageFX.dopus5 1.0 (30.8.97)
  3.  Written by Tommy Jensen
  4.  Send images to ImageFX from DirectoryOpus
  5.  Call as:
  6.  <AREXX>DOpus5:ARexx/ImageFX.dopus5
  7. */
  8.  
  9. /* Change this to the path where ImageFX is located (Don't remove the brackets) */
  10. ImageFX = 'ImageFX:ImageFX'
  11.  
  12. options results
  13.  
  14. lf='0a'x /* Thanks to Edmund Vermeulen for that sneaky code :) */
  15.  
  16. if Show("P","DOPUS.1") then
  17.  address "DOPUS.1"
  18. Else Do
  19.  exit
  20.  end
  21.  
  22. dopus version
  23. If ( result='RESULT' | translate(result,'.',' ') < 5.1218 ) then do
  24.     dopus request '"This script requires DOpus v5.5 or greater." OK'
  25.  exit
  26.  end
  27.  
  28. lister query source
  29. slist=result
  30.  
  31. lister query slist numselfiles
  32. if result=0 then do
  33.  lister request slist '"No selected files."' 'OK'
  34.  exit
  35.  end
  36.  
  37. lister query slist firstsel
  38. pic = Strip(result,"B",'"')
  39.  
  40. lister query slist path
  41. picpath=result
  42.  
  43. lister set slist busy on
  44. lister set slist newprogress name info title
  45. lister set slist newprogress title 'ImageFX.dopus5 by Tommy Jensen 97'
  46. lister set slist newprogress info 'Checking filetype'
  47. dopus getfiletype picpath''pic'' id
  48. picftype=result
  49. lister set slist newprogress info ' '
  50. lister set slist newprogress name pic'  ('picftype')'
  51.  
  52. lister set slist newprogress info 'Looking for ImageFX...'
  53. if Show("P","IMAGEFX.1") then call CHECKIFX
  54. Else Do
  55.  dopus front
  56.  lister request slist '"ImageFX does not seem to be loaded.'lf'Load ImageFX?"' '_Yes|_No'
  57.  
  58. if rc=1 then
  59.  call LOADIFX
  60. else do
  61.  lister set slist newprogress info 'Aborting...'
  62.  call EXIT
  63.  
  64. CHECKIFX:
  65.          address "IMAGEFX.1"
  66.          options failat 3000
  67.          GETMAIN
  68.          If rc>0 then
  69.           call SENDIFX
  70.          Else Do
  71.           parse var result name .
  72.           address "DOPUS.1"
  73.           dopus front 
  74.           lister request slist '"The ImageFX main buffer is not empty.'lf'Project 'name lf'will be destroyed"' '_Continue|_Abort'
  75.          If rc=1 then
  76.           call SENDIFX
  77.          Else Do
  78.           lister set slist newprogress info 'Aborting...'
  79.           call EXIT
  80.  
  81. LOADIFX:
  82.         lister set slist newprogress info 'Launching ImageFX...'
  83.         address command "RUN >NIL: "ImageFX
  84.         address command "WaitForPort IMAGEFX.1"
  85.         address command "Wait 1" /* This is needed for some strange reason */
  86.         lister set slist newprogress info 'ImageFX loaded...'
  87.  
  88. SENDIFX:
  89.         options failat 2
  90.         address "DOPUS.1"
  91.         lister set slist newprogress info 'Loading 'picftype' file...'
  92.         address "IMAGEFX.1"
  93.         LOADBUFFER FILE picpath''pic'' FORCE  /* Load picture */
  94.         SCREENTOFRONT  /* Bring IFX screen to front */
  95.         address "DOPUS.1"
  96.         lister select slist pic off
  97.  
  98. EXIT:
  99.      lister refresh slist
  100.      lister set slist busy off
  101.      exit
  102.